<template>
  <v-plain-dialog ref="audit">
    <el-form label-width="220px" label-position="right">
      <v-form-title title="账号绑定"/>
      <el-form-item label="企业名称">{{current.accountPerson}}</el-form-item>
      <el-form-item label="银行行号">{{current.bankNumber}}</el-form-item>
      <el-form-item label="银行账号">{{current.accountNumber}}</el-form-item>

      <el-form-item>
        <el-button size="small" type="primary" @click="audit(current.enterpriseUserId,0)">通过</el-button>
        <el-button size="small" @click="audit(current.userId,1)">驳回</el-button>
      </el-form-item>

    </el-form>
  </v-plain-dialog>
</template>

<script lang="ts">
  import { Vue, Component } from 'vue-property-decorator'
  import vPlainDialog from '@/components/plain-dialog'
  import vFormTitle from '@/components/form-title'

  @Component({
    components: {
      vPlainDialog,
      vFormTitle
    }
  })
  export default class Merchants extends Vue {

    previewImage (src) {
      window.open(src)
    }

    current = {
      accountNumber: '',
      accountPerson: '',
      bankNumber: '',
      enterpriseUserId: '',
      id:''
    }

    async audit (enterpriseUserId, reviewResults) {
      let res: AjaxResponse = await this.$axios.post('b/boms/member/reviewaccount', {
        enterpriseUserId, reviewResults,accountId:this.current.id
      })
      this.$utils.tips(res)
      if (res.responseCode === 200) {
        this.$refs.audit.closeDialog()
        this.$emit('initList')
      }
    }

    async openDialog ({enterpriseUserId,id}) {
      let res: AjaxResponse = await this.$axios.get(`g/gateway/account/user/${enterpriseUserId||id}`)
      if(res.data.length !== 0){
        this.current = res.data[0]
        this.current.enterpriseUserId = enterpriseUserId
      }
      this.$refs.audit.openDialog()
    }
  }
</script>

<style lang="less" scoped>
  .images {
    display: flex;
    justify-content: space-around;
    margin-bottom: 30px;
    .item {
      width: 210px;
      text-align: center;
      .bd {
        border: 1px solid #ddd;
        padding: 10px 0;
      }

      img {
        width: 180px;
        height: 148px;
      }
    }

    p {
      font-size: 16px;
      color: #666666;
      text-align: center;
      padding-bottom: 20px;
    }
  }
</style>
